var orderList;
var localData =[
    {"orderId": 20160216123456,"productName": "户外啥的乱七八糟1","phone":15868721752,"count":13,"price":10,"totalPrice":130,"state":1,"orderTime":'2016-1-12 9:05'},
    {"orderId": 20160216123457,"productName": "户外啥的乱七八糟1","phone":15868721752,"count":13,"price":10,"totalPrice":130,"state":0,"orderTime":'2016-1-12 9:05'},
    {"orderId": 20160216123458,"productName": "户外啥的乱七八糟1","phone":15868721752,"count":13,"price":10,"totalPrice":130,"state":2,"orderTime":'2016-1-12 9:05'},
    {"orderId": 20160216123459,"productName": "户外啥的乱七八糟1","phone":15868721752,"count":13,"price":10,"totalPrice":130,"state":3,"orderTime":'2016-1-12 9:05'},
    {"orderId": 20160216123450,"productName": "户外啥的乱七八糟1","phone":15868721752,"count":13,"price":10,"totalPrice":130,"state":4,"orderTime":'2016-1-12 9:05'},
    {"orderId": 20160216123451,"productName": "户外啥的乱七八糟1","phone":15868721752,"count":13,"price":10,"totalPrice":130,"state":5,"orderTime":'2016-1-12 9:05'}
];
$(function(){
	orderList = $.fn.bsgrid.init('orderList', {
        localData: localData,   //本地json
        //url:'',               //数据地址
        // autoLoad: false,
        pageSizeSelect: true,
        pageSize: 10,
        stripeRows: true,
        displayBlankRows: false
    });
})

var order={
	//产品状态
    state:function(record, rowIndex, colIndex, options){
    	var state=orderList.getRecordIndexValue(record, 'state'),html;
    	switch(state){
    		case "0":
    		return '<span class="sui-text-disabled">未付款</span>';
    		case "1":
    		return '<span class="sui-text-info">已付款</span>';
    		case "2":
    		return '<span class="sui-text-success">订单完成</span>';
    		case "3":
    		return '<span class="sui-text-disabled">订单关闭</span>';
    		case "4":
    		return '<span class="sui-text-danger">申请退款</span>';
    		case "5":
    		return '<span class="sui-text-success">退款完成</span>';
    	}
    },
    //表格操作
    operate:function(record, rowIndex, colIndex, options){
        var id=orderList.getRecordIndexValue(record, 'id');
        return '<a href="orderDetails.html?id=' + id + '">查看</a>';
    },
    //搜索
    search:function(){
        var form=$("#seach").serializeArray();
        orderList.search(form);
    }
}
